package com.atguigu.publisher1.mappers;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public interface ProductStatsMapper {

    //查询销售总额
    @Select("select sum(order_amount) from product_stats_210108 where toYYYYMMDD(stt)=#{date}")
    public BigDecimal selectGMV(int date);

    //按照品牌查询销售额
    @Select("select tm_name,sum(order_amount) order_amount from product_stats_210108 where toYYYYMMDD(stt)=#{date} group by tm_name order by order_amount desc limit #{limit}")
    List<Map> selectGmvByTm(@Param("date") int date, @Param("limit") int limit);

}
